Allow deprecated use of SipHasher
authorAlex Crichton <alex@alexcrichton.com>
Fri, 30 Sep 2016 16:17:36 +0000 (09:17 -0700)
committerAlex Crichton <alex@alexcrichton.com>
Fri, 30 Sep 2016 16:17:36 +0000 (09:17 -0700)
This type is being deprecated in rust-lang/rust#36815, so allow use of the
deprecated type for now. We can fix this later once new APIs have landed.

src/cargo/sources/git/source.rs
src/cargo/util/hex.rs

index 3ab8b79c63828f2335aa107f6418ce2197fbe82c..eeffcb05b724d7e5a7044729c3f6848c4d52aa3f 100644 (file)
@@ -1,12 +1,12 @@
 use std::fmt::{self, Debug, Formatter};
-use std::hash::{Hash, Hasher, SipHasher};
 
 use url::Url;
 
 use core::source::{Source, SourceId};
 use core::GitReference;
 use core::{Package, PackageId, Summary, Registry, Dependency};
-use util::{CargoResult, Config, to_hex};
+use util::{CargoResult, Config};
+use util::hex::short_hash;
 use sources::PathSource;
 use sources::git::utils::{GitRemote, GitRevision};
 
@@ -57,8 +57,6 @@ impl<'cfg> GitSource<'cfg> {
 }
 
 fn ident(url: &Url) -> String {
-    let mut hasher = SipHasher::new_with_keys(0,0);
-
     let url = canonicalize_url(url);
     let ident = url.path_segments().and_then(|mut s| s.next_back()).unwrap_or("");
 
@@ -68,8 +66,7 @@ fn ident(url: &Url) -> String {
         ident
     };
 
-    url.hash(&mut hasher);
-    format!("{}-{}", ident, to_hex(hasher.finish()))
+    format!("{}-{}", ident, short_hash(&url))
 }
 
 // Some hacks and heuristics for making equivalent URLs hash the same
index 43687b75dfb5a3cba93dc236ae5c81cfd95cc7d7..28fed76fc0f7f6480d04a8acf470e4f6928a39be 100644 (file)
@@ -1,3 +1,5 @@
+#![allow(deprecated)]
+
 use std::hash::{Hasher, Hash, SipHasher};
 
 use rustc_serialize::hex::ToHex;